var app = function() {
  var mustache;
  var renderHtml;
  var $scope = {};
  var $node;

  // 引入布局的模版碎片
  var layoutTpl;
  var moduleIframeTpl;
  var listTpl;
  var infoTpl;
  var $;
  var Highcharts;

  var parseDOM = function() {
    console.log('super parseDOM sb123456789');
    $ = this.exports.$;
    Highcharts = this.exports.Highcharts;
    mustache = require('mustache');
    renderHtml = require('../../utils/renderHtml/js/index');
    layoutTpl = require('../tpl/layout/layout_1.html');
    listTpl = require('../tpl/module/list.html');
    infoTpl = require('../tpl/module/info.html');
    this.$scope = {
      layout: layoutTpl,
      modules: [
        {
          title: 'list',
          tpl: listTpl
        },

        {
          title: 'info',
          tpl: infoTpl
        }
      ]
    };
    renderHtml(this.$scope, $);
    console.log('Highcharts', Highcharts);
  };

  var bindListener = function() {
    console.log('super bindListener');
  };

  var initPlugins = function() {
    console.log('this', this);
    this.$scope.name = 'super';
    console.log('this.$scope', this.$scope.name);
    console.log('super initPlugins');
    console.log('hello world');
  };

  var init = function(exports) {
    this.exports = exports;
    this.parseDOM();
    this.bindListener();
    this.initPlugins();
  };

  this.$scope = $scope;
  this.init = init;
  this.parseDOM = parseDOM;
  this.bindListener = bindListener;
  this.initPlugins = initPlugins;

  // 暴露所有函数 方便继承
  return this;
};
module.exports = app;
